---
import Button from "./Button.astro";
import CountdownTimer from "./CountdownTimer";
---

<aside class="reactgg-container container">
  <div class="reactgg-banner">
    <a href="https://react.gg?s=usehooks" class="reactgg-header">
      <img
        src={"/img/banner-sale-reactgg.svg"}
        alt="react.gg - The interactive way to master modern React"
        class="reactgg-headline"
      />
    </a>
    <div class="reactgg-spacer"></div>
    <div class="reactgg-cta">
      <div class="reactgg-cta-container">
        <h2>react.gg Launch Sale</h2>
        <p>Get 30% off through May 23rd</p>
        <CountdownTimer client:only targetDate="2025-05-24" />
        <Button
          text="Join Now"
          size="small"
          href="https://react.gg?s=usehooks"
          type="link"
          color="yellow"
          class="join-now mt-4 mb-1 lg:mb-2 inline-block"
        />
      </div>
    </div>
  </div>
</aside>

<style>
  .reactgg-container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto 30px;
  }

  .reactgg-banner {
    width: 100%;
    background-color: var(--brand-charcoal);
    border: 2px solid var(--brand-charcoal);
    border-radius: 8px;
    box-shadow: 0.2rem 0.2rem 0 var(--brand-charcoal);
    overflow: hidden;
    @media (min-width: 1024px) {
      display: grid;
      grid-template-columns: 1fr 40px 1fr;
    }
  }

  .reactgg-header {
    display: grid;
    align-self: center;
    place-items: center;
    align-content: center;
    height: 190px;
    overflow: hidden;
    @media (min-width: 1024px) {
      height: 280px;
      grid-column: 1 / 3;
      grid-row: 1;
    }
  }

  .reactgg-headline {
    width: 110%;
    max-width: none;
  }

  .reactgg-spacer {
    width: 40px;
    margin-left: 20px;
    display: none;
    background-color: var(--brand-green);
    z-index: 0;
    transform: skew(-7deg);
    @media (min-width: 1024px) {
      display: block;
      grid-column: 2;
      grid-row: 1;
      height: 100%;
    }
  }

  .reactgg-cta {
    padding: 0.5rem;
    display: grid;
    justify-content: center;
    background-color: var(--brand-green);
    color: var(--brand-charcoal);
    z-index: 10;
    @media (min-width: 1024px) {
      padding-bottom: 0;
      grid-row: 1;
      grid-column: 3;
    }
  }

  .reactgg-cta-container {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    place-self: center;
    text-align: center;
    text-transform: uppercase;

    h2 {
      margin-top: 0;
      margin-bottom: 0.5rem;
      font-size: 1.25rem;
      line-height: 1.75rem;
      font-weight: 600;
      color: var(--brand-coal);
      @media (min-width: 1024px) {
        font-size: 1.5rem;
        line-height: 2rem;
      }
      @media (min-width: 1280px) {
        font-size: 1.875rem;
        line-height: 2.25rem;
      }
    }

    h2 + p {
      margin-top: 0;
      margin-bottom: 1.2rem;
      text-transform: none;
      font-size: 90%;
    }
  }

  :global(.countdown-colon),
  :global(.countdown-number) {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }
</style>
